/**
 * Created by novem on 2015/11/2.
 */
window.onload=function() {
    var orderId = $.getUrlParam("orderId");
    var url = getUrl();
    $.jsonp({
        url: 'http://'+url+'/api/order/order_detail-' + orderId,
        data: {},
        callbackParameter: "callback",
        success: function (data, textStatus, xOptions) {
            if(data.shoptype==4){
                $("#pwdetail").attr("href","meishi_moredetail.html?supplierId="+data.supplierId);
                $("pay").attr("href","meishi_zhifudingdan.html?supplierId"+orderId);
            }
            if(data.shoptype==5){
                $("#pwdetail").attr("href","jiudian_moredetail.html?supplierId="+data.supplierId);
                $("pay").attr("href","jiudian_zhifudingdan.html?supplierId"+orderId);
            }
            if(data.shoptype==6){
                $("#pwdetail").attr("href","yiren_moredetail.html?supplierId="+data.supplierId);
                $("pay").attr("href","yiren_zhifudingdan.html?supplierId"+orderId);
            }
            var unixTimestamp = new Date(data.createTime * 1000);
            data.createTime = unixTimestamp.toLocaleString();
            var complied_tpl = juicer($("#top_tpl").text());
            var html = complied_tpl.render(data);
            $("#top").append(html);
            var complied_tpl1 = juicer($("#detail_tpl").text());
            var html1 = complied_tpl1.render(data);
            $(".detail").append(html1);
            var complied_tpl2 = juicer($("#commit").text());
            var html2 = complied_tpl2.render(data);
            $(".buy-bar").append(html2);
        },
        error: function (xOptions, textStatus) {
        }
    });
}